require 'rubygems'
require 'savon'
require 'xmlrpc/client'

class UserInfo
  def initialize
    @client = Savon::Client.new do
      wsdl.document = "http://mc747grupo04.heliohost.org/ProtecaoAoCredito.asmx?WSDL=0"
      #      wsdl.element_form_default = :unqualified
      # Make an object to represent the XML-RPC server.
    end
    @server_cliente_rpc = XMLRPC::Client.new2( 'http://201.77.177.204:8082')
  end
  
  def check_credit_situation(cpf)
#    r = @client.request :consulta_cpf
#    puts "r: "
#    puts r
#    h = r.to_hash
#    list = h[:listar_categorias_response][:return][:item]
    'regular'
  end
  
  def consultarCliente(cpf_cnpj)
     @server_cliente_rpc.call("consultarClientePython", cpf_cnpj)
  rescue
    
  end
end
